import {getRSAEncrypt, randomKey} from "@/utils/util.js"
const headers = (options)=>{
	// 基础格式
	let header = { "Content-Type": options.contentType||"application/json", appKey: getApp().globalData.api.appKey }
	// 除用户登录外所有接口都需要令牌认证及Key
	if (!options.ISTOKEN) {
		let message = {
			"Authorization": uni.getStorageSync('VMSATOKEN'),
			"Key": uni.getStorageSync('VMSKEY') ? getRSAEncrypt(uni.getStorageSync('VMSPUBLICKKEY'),uni.getStorageSync('VMSKEY')) : getRSAEncrypt(uni.getStorageSync('VMSPUBLICKKEY'), randomKey(16))
		}
		header = Object.assign({},header,message)
	}
	return header;
}
export {
	headers
}